const Index = r => require(['../views/index'], r)
const Forecast = r => require(['../views/forecast'], r)
const Author = r => require(['../views/author'], r)
const Lottery = r => require(['../views/lottery'], r)
const ForecastDetail = r => require(['../views/forecastDetail'], r)

// 根目录
const rootPath = ''

// 页面路由
const routes = [{
  path: '',
  redirect: {
    name: 'index'
  }
}, {
  path: '/',
  component: Index,
  name: 'index'
}, {
  path: '/',
  component: Lottery,
  name: 'lottery'
}, {
  path: '/forecast',
  component: Forecast,
  name: 'forecast'
}, {
  path: '/author',
  component: Author,
  name: 'author',
  children: [{
    path: 'forecastDetail/:id',
    component: ForecastDetail,
    name: 'forecastDetail'
  }]
}].map(route => {
  route.path = rootPath + route.path
  return route
})

// 404 页
// routes.push({
//   path: '*',
//   component: NotFound,
//   name: 'notfound'
// })

export default routes
